//package cn.kgc.rainmanager.Controller;
//
//import cn.kgc.rainmanager.pojo.AirQI;
//import cn.kgc.rainmanager.pojo.ResultEntity;
//import cn.kgc.rainmanager.service.AirQIService;
//import cn.kgc.rainmanager.service.AirQIServiceImpl;
//import com.github.pagehelper.PageInfo;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.annotation.Resource;
//
///**
// * @author 陈啸
// * @create 2020-05-21 10:22
// */
//@RestController
//public class AirQIController {
//    @Resource
//    AirQIService airQIService;
//
//    @RequestMapping("/selectAir")
//    public ResultEntity<PageInfo<AirQI>> selectEntry(@RequestParam(value = "districtid", required = false, defaultValue = "0") Integer districtid,
//                                                     @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
//                                                     @RequestParam(value = "pageSize", required = false, defaultValue = "2") Integer pageSize) {
//        PageInfo<AirQI> pageInfo = airQIService.getSelect(pageNum, pageSize, districtid);
//        return ResultEntity.successWithoutData(pageInfo);
//    }
//
//
//    //前端post请求，参数是json必须添加@RequestBody
//    //添加和修改
//    @RequestMapping("/saveEntry")
//    public ResultEntity<String> saveEntry(@RequestBody AirQI airQI) {
//        try {
//            Integer integer = 0;
//            if (airQI.getId() == null) {
//                integer = airQIService.add(airQI);
//            } else {
//                integer = airQIService.update(airQI);
//            }
//            return ResultEntity.successWithoutData(integer+"");
//        }catch (Exception ex){
//            return ResultEntity.successWithoutData(ex.getMessage());
//        }
//    }
//    //根据id查询
//    @RequestMapping("/getEntryId")
//    public ResultEntity<AirQI> getEntryId(Integer id) {
//        AirQI entry = airQIService.selectById(id);
//        return ResultEntity.successWithoutData(entry);
//    }
//
//    //根据id删除
//    @RequestMapping("/delEntryId")
//    public ResultEntity<String> delEntryId(Integer id) {
//        try{
//            Integer integer = airQIService.delete(id);
//            return ResultEntity.successWithoutData(integer+"");
//        }catch (Exception ex){
//            return ResultEntity.failed(ex.getMessage());
//        }
//    }
//}
